import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
// 导航守卫
import '@/permission' // permission control

// 注册全局自定义组件
// Vue.directive('指令名','生命周期函数')
import directive from '@/directives'
Object.keys(directive).forEach((item) => {
  Vue.directive(item, directive[item])
})

// 使用Vue.use注册全局组件
import libJs from '@/components/lib/inde'
Vue.use(libJs, '我是全局注册')
// 注册全局组件
import HMnum from '@/layout/components/HMnum/index.vue'
// import PageTools from '@/components/lib/pageTools.vue'
Vue.component(HMnum.name, HMnum)
// Vue.component(PageTools.name, PageTools)
// 设置兄弟组件通信
Vue.prototype.$bus = new Vue()

// 打印插件
import Print from 'vue-print-nb'
Vue.use(Print)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// 如果当前环境是开发环境 继续使用mock
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: (h) => h(App)
})
